  // 获取数据(配置信息)
  var antiqueName = ''; //文物名称
  var description = ''; //简介
  var subjectPathApp = ''; //专题链接
  var id = ''; //文物id
  var littleImage = '';
  var audioPath = ''; //音频路径
  var uploadPath = ''; //视频路径
  var uploadType = ''; //文物类型
  var num='';


  //线上配置信息
  var url = 'http://shunde.museum.chaoxing.com/'; //后端接口
  var stageUrl = 'http://file.museum.chaoxing.com/micro-upload/'; //访问文片地址

  // 测试配置信息

   /*var url = 'http://120.92.71.241:8028/'; //后端接口
   var stageUrl = 'http://data.museum.chaoxing.com/micro-upload/'; //访问文片地址*/

  //本地配置信息

  /*var url = 'http://localhost:10010/'; //后端接口
  var stageUrl = 'http://192.168.20.45/file/'; //访问文片地址*/

  var logoName = 'logo'; //左上角logo
  var bigLogoName = "bigTitle"; //大logo

 //获取当前网址
  var htmlHref = window.location.href;
  var indexnum = htmlHref.lastIndexOf("\/");
  var nowUrl = decodeURI(htmlHref.substring(0, indexnum));
 console.log('当前地址根',nowUrl)



  function getAntique(page, limit) {

      $.ajax({
          url: url + "api/antique3d/front/antique",
          type: "get",
          data: {
              "page": page,
              "limit": limit,
              "columnId": getQueryStringRegExp('id')
          },
          async: false,
          success: function (data) {
              var rows = data.data.rows;
               // console.log('rows', rows);
              // 底部导航
              var html = '';

              for (var i = 0; i < rows.length; i++) {
                  littleImage = stageUrl + rows[i].littleImage;
                  id = rows[i].id;
                  html += '<div class="swiper-slide" antique_id="' + id + '"><img src="' + littleImage + '"></div>';

              }
              $('#nav_bottom .swiper-wrapper').append(html);

          },

          error: function (error) {
              console.log(error);
          }
      });

  }
  getAntique(1, 100);


  // 默认数据

  // 默认标题显示

  function getAntiqueId(Id) {

      $.ajax({
          url: url + "api/antique3d/front/antique/" + Id,
          type: "get",
          async: false,
          success: function (data) {
            //   console.log(data)

              var antique = data.data;
              var attribute3d = data.data.attribute3d;
              console.log(attribute3d);
              // 默认文物名称
              antiqueName = antique.antiqueName;
              description = antique.description;
              subjectPathApp = antique.subjectPathApp;
              audioPath = stageUrl + antique.audioPath;
              uploadPath = antique.uploadPath;
              uploadType = antique.uploadType;
              littleImage = antique.littleImage;
              $('.desTitle').html(antiqueName);
              $('.description').html(description);
              // 专题二维码
              $('#ewmqrcode').empty();

              if (subjectPathApp && subjectPathApp != '') {
                  var ewmqrcode = new QRCode(document.getElementById("ewmqrcode"), {
                      width: 130,
                      height: 130
                  });
                  ewmqrcode.makeCode(subjectPathApp);
              } else {
                  $('.zhuanti').hide();
              }
              if (antique.audioPath && antique.audioPath != '') {
                  // 添加音频
                  $('#voice').attr({
                      "src": audioPath
                  });
              }else {
                  $('#radio').hide();
              }
              //3d文物
              if (uploadType == '3d') {
                  $('#Relics').attr({
                      "src": './antique.html?id=' + antique.id
                  })
                  //360
              } else if (uploadType == '360') {

                  $('#Relics').attr({
                      "src": './360.html?id=' + antique.id
                  })
                  var Img360 = uploadPath.split("|");
                  var html = '';
                  for (var i = 0; i < Img360.length; i++) {
                      html += '<li><img src="' + stageUrl + Img360[i] + '" alt="' + Img360[i] + '"></li>';
                  }
                  $('#imgbox ul').html(html);
                  //视频      
              } else if (uploadType == 'video') {
                  $('#Relics').attr({
                      "src": './video.html?id=' + antique.id
                  })
                  $('source').attr({
                      "src": stageUrl + uploadPath
                  })
                  $('video').attr({
                      "poster": stageUrl + littleImage
                  })

              } else {
                  $('#Relics').attr({
                      "src": './img.html?id=' + antique.id
                  })
                  $('#containRelics img').attr({
                      "src": stageUrl + uploadPath
                  })
                  $('#containRelics a').attr({
                      "href": stageUrl + uploadPath
                  })
              }


          },
          error: function (error) {
              console.log(error);
          }

      })

  }

  //3d文物参数
  var tex, scale, PLight, Alight, hightlight, photonear, photofar, ambientcolor, pointColor;
  var angleX = [];
  var angleY = [];
  var angleZ = [];
  var axisX = [];
  var anisY = [];
  var anisZ = [];
  var tex = [];
  var model = [];
  var modelName = []
  var mtl = [];
  var index2 = [];
  var index = [];
  var mtlUrl = [];
  var mtlName = [];

  function getAttribute3d(Id) {
      $.ajax({
          url: url + "api/antique3d/front/antique/" + Id,
          type: "get",
          async: false,
          success: function (data) {

              var attribute3d = data.data.attribute3d;
              var attributeModels = data.data.attribute3d.attributeModels;

              // 默认文物名称
              photonear = attribute3d.minDistance; //远相机
              photofar = attribute3d.maxDistance; //近相机
              scale = attribute3d.zoomRatio; //缩放
              PLight = attribute3d.pointLight; //点光
              pointColor = attribute3d.pointColor; //点光颜色
              hightlight = attribute3d.highlight; //高光颜色
              Alight = attribute3d.envLight; //环境光
              ambientcolor = attribute3d.envColor; //环境光颜色
              //   console.log(typeof photonear,typeof photofar,typeof scale,typeof ambientcolor);
              //模型
              for (var i = 0; i < attributeModels.length; i++) {
                  angleX.push(attributeModels[i].angleX); //x轴
                  angleY.push(attributeModels[i].angleY); //y轴
                  angleZ.push(attributeModels[i].angleZ); //z轴
                  axisX.push(attributeModels[i].axisX); //x轴
                  anisY.push(attributeModels[i].axisY); //y轴
                  anisZ.push(attributeModels[i].axisZ); //z轴
                  model.push((stageUrl + attributeModels[i].modelPath)); //文物路径
                  index2.push(model[i].lastIndexOf("\/"));
                  modelName.push(model[i].substring(index2[i] + 1, model[i].length)); //文物名称

                  if (attributeModels[i].chartlet) {
                      tex.push((stageUrl + attributeModels[i].chartlet)); //文物贴图
                  }
                  if (attributeModels[i].mtlFile) {
                      mtl.push(stageUrl + attributeModels[i].mtlFile); //文物mtl
                      index.push(mtl[i].lastIndexOf("\/"));
                      mtlUrl.push(mtl[i].substring(0, index[i] + 1));
                      mtlName.push(mtl[i].substring(index[i] + 1, mtl[i].length));
                  }
              }


          },
          error: function (error) {
              console.log(error);
          }

      })
  }

  //   获取文物类别



  function getColumn(page, limit) {
      $.ajax({
          url: url + "api/antique3d/front/column",
          type: "get",
          async: false,
          data: {
              "page": page,
              "limit": limit,
              "museumCode": getCookie('museumCode')
          },
          success: function (data) {
            console.log(getCookie('museumCode'));
              var column = data.data.rows;
              var id = getQueryStringRegExp('id');
              mum=Number(column.length);

              // 导航
              var html = '';
              for (var i = 0; i < column.length; i++) {
                  html += '<div class="swiper-slide" id=' + column[i].id + '><a href="' + nowUrl + '/des.html?id=' + column[i].id + '" class=""><i style="background:' + column[i].columnColor + ';"></i><span>' + column[i].name + '</span></a> </div>';
              }
           
              $('#nav .swiper-wrapper').append(html);

              var indexhtml = '';

              for (var i = 0; i < column.length; i++) {
                  indexhtml += '<div class="Item3d" onclick="javascript:window.location.href=\'./des.html?id=' + column[i].id + '\'" >';
                  indexhtml += '<div class="item">';
                  indexhtml += '<img src="' + stageUrl + column[i].columnPath + '" alt="' + column[i].name + '">';
                  indexhtml += '<span style="color:' + column[i].columnColor + '">' + column[i].name + '</span>';
                  indexhtml += '</div>';
                  indexhtml += '</div>';
                 
              }
 
              indexhtml += '<div class="Item3d" onclick="javascript:window.location.href=\'./des.html?id=' + column[0].id + '\'" >';
              indexhtml += '<div class="item">';
              indexhtml += '<img src="' + stageUrl + column[0].columnPath + '" alt="' + column[0].name + '">';
              indexhtml += '<span style="color:' + column[0].columnColor + '">' + column[0].name + '</span>';
              indexhtml += '</div>';
              indexhtml += '</div>';
             
              $('.cont3dlist').append(indexhtml);

          },
          error: function (error) {
              console.log(error);

          }
      })

  }
//    getColumn();

  function getLogo() {
    console.log(getCookie('museumCode'));
      $.ajax({
          url: url + "api/antique3d/front/logo",
          type: "get",
          data: {
            "museumCode": getCookie('museumCode')
        },
          async: false,
          success: function (data) {
              var logo = data.data;
            console.log('logo',logo)

            if(logo.length==0){
                $('.bigTitle img').attr({
                    "src": nowUrl+'/image/logo/BigTitle.png'
                });
            }else{

                for (var i = 0; i < logo.length; i++) {
                    if (logo[i].logoCode == logoName) {
                        $('.logo img').attr({
                            "src": stageUrl + logo[i].logoPath
                        });
                       $('.logo a').attr({
                          "href": './index.html?museumCode='+getCookie('museumCode')+''
                      }); 
                    }
                    if (logo[i].logoCode == bigLogoName) {
                        $('.bigTitle img').attr({
                            "src": stageUrl + logo[i].logoPath
                        });
                    }else{
                      $('.bigTitle img').attr({
                          "src": nowUrl+'/image/logo/BigTitle.png'
                      });
                    }
  
                }
            }

          },
          error: function (error) {
              console.log(error);


          }

      })

  }
  getLogo();

  function getQueryStringRegExp(name) {
      var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
      if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " "));
      return "";
  };

  // 判断区域还是总分馆